import requests
from lxml import etree
import os
url='https://pic.netbian.com/4kfengjing/'
header={'user-agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36'}
response=requests.get(url=url,headers=header)
response.encoding='gbk'
page=response.text
tree = etree.HTML(page)
li_list=tree.xpath("//ul[@class='clearfix']/li")
if not os.path.exists('4k图片'):
    os.mkdir('4k图片')
for li in li_list:
    img_src='https://pic.netbian.com/'+li.xpath('./a/img/@src')[0]
    img_name=li.xpath('./a/img/@alt')[0]+'.jpg'
    with open('4k图片/'+img_name,'wb') as fp:
        content=requests.get(url=img_src,headers=header).content
        fp.write(content)
